var fs = require('fs');

var ws = fs.createWriteStream("createWriteStream2.txt");

ws.once('open', function() {
  console.log('文件打开了');
});

ws.once('close', function() {
  console.log('文件关闭了');
})

ws.write('第一行\n')
ws.write('第二行\n')
ws.write('第三行\n')
ws.end()
